import 'package:elephant_fish/http/core/hi_net.dart';
import 'package:elephant_fish/http/request/all_contribute_request.dart';
import 'package:elephant_fish/http/request/base_request.dart';
import 'package:elephant_fish/http/request/charm_rank_request.dart';
import 'package:elephant_fish/http/request/family_rank_request.dart';
import 'package:elephant_fish/model/anchor_entity.dart';
import 'package:elephant_fish/model/contribute_rank_entity.dart';
import 'package:elephant_fish/model/family_entity.dart';
import 'package:elephant_fish/util/TxUtils.dart';
import 'package:elephant_fish/util/size_util.dart';
import 'package:elephant_fish/widget/charm_rank_list.dart';
import 'package:elephant_fish/widget/new_rank_list.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';

import 'login_page.dart';

class IndexNewRankPage extends StatefulWidget {
  final String rankName;

  const IndexNewRankPage({Key key, this.rankName}) : super(key: key);

  @override
  _IndexNewRankPageState createState() => _IndexNewRankPageState();
}

class _IndexNewRankPageState extends State<IndexNewRankPage> {
  int _currentSelectIndex = 0;
  int rankNum = 0;
  ScrollController _scrollController = ScrollController();
  List<ContributeRankEntity> contributeRankEntitys;
  List<FamilyEntity> familyEntitys;
  List<AnchorEntity> anchorEntitys;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    getRankList();
  }

  @override
  Widget build(BuildContext context) {
    final size = MediaQuery.of(context).size;
    return Scaffold(
      backgroundColor: Color(0xff140c3d),
      body: Column(
        children: [
          Align(
            alignment: Alignment.topCenter,
            child: Container(
              width: 260,
              height: 33,
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.all(Radius.circular(16.5)),
                  color: Color(0x40ffffff)),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: _getTabs(),
              ),
            ),
          ),
          SizedBox(
            height: 13.5,
          ),
          rankNum == 0
              ? Container(
                  width: 375,
                  height: 252.5,
                  decoration: BoxDecoration(
                    image: DecorationImage(
                        image: AssetImage('assets/images/rankbg.png')),
                  ),
                  child: Row(
                    children: [
                      // Padding(padding: EdgeInsets.only(left: 20,top: 58.5),
                      //   child:
                      //   Column(
                      //     mainAxisAlignment: MainAxisAlignment.center,
                      //     children: [
                      //       Stack(
                      //         children: [
                      //           Padding(padding: EdgeInsets.only(left: 10,top: 10),
                      //             child:  CircleAvatar(
                      //               backgroundImage: NetworkImage(
                      //                 // 'http://119.28.131.94:82' +
                      //                   'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'),
                      //               radius: 30,
                      //             ),
                      //           ),
                      //           Container(
                      //             width:80 ,
                      //             height: 80,
                      //             decoration: BoxDecoration(
                      //               image: DecorationImage(
                      //                   image: AssetImage('assets/images/secondrank.png')),
                      //             ),
                      //
                      //           ),
                      //         ],
                      //       ),
                      //
                      //       SizedBox(
                      //         height: 8.5,
                      //       ),
                      //       Row(
                      //         children: [
                      //           Text('万字熊',style: TextStyle(color: Color(0xfff3f3f3),fontSize: 15),),
                      //           SizedBox(width: 3,),
                      //           Image.asset('assets/images/personal_boy.png',width: 13,height: 13,),
                      //           // Image.asset('assets/images/personal_girl.png',width: 13,height: 13,)
                      //         ],
                      //       ),
                      //       SizedBox(
                      //         height: 15,
                      //       ),
                      //       Row(
                      //         children: [
                      //           Image.asset('assets/images/rank_money.png',width: 12.23,height: 12.58,),
                      //           SizedBox(width: 3,),
                      //           Text('123456789',style: TextStyle(color: Color(0xffffffff),fontSize: 13),),
                      //         ],
                      //       )
                      //     ],
                      //   ),
                      // ),
                      Spacer(),
                      Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Stack(
                            children: [
                              Padding(
                                padding: EdgeInsets.only(left: 10, top: 10),
                                child: CircleAvatar(
                                  backgroundImage: NetworkImage(
                                      // 'http://119.28.131.94:82' +
                                      anchorEntitys != null
                                          ? anchorEntitys.length > 1
                                              ? 'http://119.28.131.94:82' +
                                                  anchorEntitys[1].avatar
                                              : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'
                                          : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'),
                                  radius: 30,
                                ),
                              ),
                              Container(
                                width: 80,
                                height: 80,
                                decoration: BoxDecoration(
                                  image: DecorationImage(
                                      image: AssetImage(
                                          'assets/images/secondrank.png')),
                                ),
                              ),
                            ],
                          ),
                          Row(
                            children: [
                              Text(
                                anchorEntitys != null
                                    ? anchorEntitys.length > 1
                                        ? anchorEntitys[1].nickname
                                        : '万字熊'
                                    : '万字熊',
                                style: TextStyle(
                                    color: Color(0xfff3f3f3), fontSize: 15),
                              ),
                              SizedBox(
                                width: 3,
                              ),
                              anchorEntitys != null
                                  ? anchorEntitys.length > 1
                                      ? anchorEntitys[1].sex == '男'
                                          ? Image.asset(
                                              'assets/images/personal_boy.png',
                                              width: 13,
                                              height: 13,
                                            )
                                          : Image.asset(
                                              'assets/images/personal_girl.png',
                                              width: 13,
                                              height: 13,
                                            )
                                      : Image.asset(
                                          'assets/images/personal_boy.png',
                                          width: 13,
                                          height: 13,
                                        )
                                  : Image.asset(
                                      'assets/images/personal_boy.png',
                                      width: 13,
                                      height: 13,
                                    ),
                              // Image.asset('assets/images/personal_girl.png',width: 13,height: 13,)
                            ],
                          ),
                          SizedBox(
                            height: 5,
                          ),
                          anchorEntitys != null
                              ? anchorEntitys.length > 1
                                  ? anchorEntitys[1].anchorTitle == '常在'
                                      ? Image.asset(
                                          'assets/images/changzaiicon.png',
                                          height: 12,
                                        )
                                      : anchorEntitys[1].anchorTitle == '良人'
                                          ? Image.asset(
                                              'assets/images/liangrenicon.png',
                                              height: 12,
                                            )
                                          : anchorEntitys[1].anchorTitle == '贵嫔'
                                              ? Image.asset(
                                                  'assets/images/guipinicon.png',
                                                  height: 12,
                                                )
                                              : anchorEntitys[1].anchorTitle ==
                                                      '贵妃'
                                                  ? Image.asset(
                                                      'assets/images/guifeiicon.png',
                                                      height: 12,
                                                    )
                                                  : anchorEntitys[1]
                                                              .anchorTitle ==
                                                          '皇后'
                                                      ? Image.asset(
                                                          'assets/images/huanghouicon.png',
                                                          height: 12,
                                                        )
                                                      : anchorEntitys[1]
                                                                  .anchorTitle ==
                                                              '神女'
                                                          ? Image.asset(
                                                              'assets/images/shennvicon.png',
                                                              height: 12,
                                                            )
                                                          : anchorEntitys[1]
                                                                      .anchorTitle ==
                                                                  '帝后'
                                                              ? Image.asset(
                                                                  'assets/images/dihouicon.png',
                                                                  height: 12,
                                                                )
                                                              : anchorEntitys[1]
                                                                          .anchorTitle ==
                                                                      '天君夫人'
                                                                  ? Image.asset(
                                                                      'assets/images/tianjunfurenicon.png',
                                                                      height:
                                                                          12,
                                                                    )
                                                                  : Image.asset(
                                                                      'assets/images/nvwaicon.png',
                                                                      height:
                                                                          12,
                                                                    )
                                  : Image.asset(
                                      'assets/images/changzaiicon.png',
                                      height: 12,
                                    )
                              : Image.asset(
                                  'assets/images/changzaiicon.png',
                                  height: 12,
                                ),
                          SizedBox(
                            height: 5,
                          ),
                          Row(
                            children: [
                              Image.asset(
                                'assets/images/rank_money.png',
                                width: 12.23,
                                height: 12.58,
                              ),
                              SizedBox(
                                width: 3,
                              ),
                              anchorEntitys != null
                                  ? anchorEntitys.length > 1
                                      ? Text(
                                          anchorEntitys[1].number,
                                          style: TextStyle(
                                              color: Color(0xffffffff),
                                              fontSize: 13),
                                        )
                                      : Text(
                                          '123456789',
                                          style: TextStyle(
                                              color: Color(0xffffffff),
                                              fontSize: 13),
                                        )
                                  : Text(
                                      '123456789',
                                      style: TextStyle(
                                          color: Color(0xffffffff),
                                          fontSize: 13),
                                    ),
                            ],
                          )
                        ],
                      ),
                      Spacer(),
                      Column(
                        children: [
                          SizedBox(
                            height: 20,
                          ),
                          Stack(
                            children: [
                              Padding(
                                padding: EdgeInsets.only(left: 10, top: 10),
                                child: CircleAvatar(
                                  backgroundImage: NetworkImage(
                                      // 'http://119.28.131.94:82' +
                                      anchorEntitys != null
                                          ? anchorEntitys.length > 0
                                              ? 'http://119.28.131.94:82' +
                                                  anchorEntitys[0].avatar
                                              : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'
                                          : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'),
                                  radius: 30,
                                ),
                              ),
                              Container(
                                width: 80,
                                height: 80,
                                decoration: BoxDecoration(
                                  image: DecorationImage(
                                      image: AssetImage(
                                          'assets/images/secondrank.png')),
                                ),
                              ),
                            ],
                          ),
                          Row(
                            children: [
                              Text(
                                anchorEntitys != null
                                    ? anchorEntitys.length > 0
                                        ? anchorEntitys[0].nickname
                                        : '万字熊'
                                    : '万字熊',
                                style: TextStyle(
                                    color: Color(0xfff3f3f3), fontSize: 15),
                              ),
                              SizedBox(
                                width: 3,
                              ),
                              anchorEntitys != null
                                  ? anchorEntitys.length > 0
                                      ? anchorEntitys[0].sex == '男'
                                          ? Image.asset(
                                              'assets/images/personal_boy.png',
                                              width: 13,
                                              height: 13,
                                            )
                                          : Image.asset(
                                              'assets/images/personal_girl.png',
                                              width: 13,
                                              height: 13,
                                            )
                                      : Image.asset(
                                          'assets/images/personal_boy.png',
                                          width: 13,
                                          height: 13,
                                        )
                                  : Image.asset(
                                      'assets/images/personal_boy.png',
                                      width: 13,
                                      height: 13,
                                    ),
                              // Image.asset('assets/images/personal_girl.png',width: 13,height: 13,)
                            ],
                          ),
                          SizedBox(
                            height: 5,
                          ),
                          anchorEntitys != null
                              ? anchorEntitys.length > 0
                                  ? anchorEntitys[0].anchorTitle == '常在'
                                      ? Image.asset(
                                          'assets/images/changzaiicon.png',
                                          height: 12,
                                        )
                                      : anchorEntitys[0].anchorTitle == '良人'
                                          ? Image.asset(
                                              'assets/images/liangrenicon.png',
                                              height: 12,
                                            )
                                          : anchorEntitys[0].anchorTitle == '贵嫔'
                                              ? Image.asset(
                                                  'assets/images/guipinicon.png',
                                                  height: 12,
                                                )
                                              : anchorEntitys[0].anchorTitle ==
                                                      '贵妃'
                                                  ? Image.asset(
                                                      'assets/images/guifeiicon.png',
                                                      height: 12,
                                                    )
                                                  : anchorEntitys[0]
                                                              .anchorTitle ==
                                                          '皇后'
                                                      ? Image.asset(
                                                          'assets/images/huanghouicon.png',
                                                          height: 12,
                                                        )
                                                      : anchorEntitys[0]
                                                                  .anchorTitle ==
                                                              '神女'
                                                          ? Image.asset(
                                                              'assets/images/shennvicon.png',
                                                              height: 12,
                                                            )
                                                          : anchorEntitys[0]
                                                                      .anchorTitle ==
                                                                  '帝后'
                                                              ? Image.asset(
                                                                  'assets/images/dihouicon.png',
                                                                  height: 12,
                                                                )
                                                              : anchorEntitys[0]
                                                                          .anchorTitle ==
                                                                      '天君夫人'
                                                                  ? Image.asset(
                                                                      'assets/images/tianjunfurenicon.png',
                                                                      height:
                                                                          12,
                                                                    )
                                                                  : Image.asset(
                                                                      'assets/images/nvwaicon.png',
                                                                      height:
                                                                          12,
                                                                    )
                                  : Image.asset(
                                      'assets/images/changzaiicon.png',
                                      height: 12,
                                    )
                              : Image.asset(
                                  'assets/images/changzaiicon.png',
                                  height: 12,
                                ),
                          SizedBox(
                            height: 5,
                          ),
                          Row(
                            children: [
                              Image.asset(
                                'assets/images/rank_money.png',
                                width: 12.23,
                                height: 12.58,
                              ),
                              SizedBox(
                                width: 3,
                              ),
                              anchorEntitys != null
                                  ? anchorEntitys.length > 0
                                      ? Text(
                                          anchorEntitys[0].number,
                                          style: TextStyle(
                                              color: Color(0xffffffff),
                                              fontSize: 13),
                                        )
                                      : Text(
                                          '123456789',
                                          style: TextStyle(
                                              color: Color(0xffffffff),
                                              fontSize: 13),
                                        )
                                  : Text(
                                      '123456789',
                                      style: TextStyle(
                                          color: Color(0xffffffff),
                                          fontSize: 13),
                                    ),
                            ],
                          )
                        ],
                      ),
                      Spacer(),
                      Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Stack(
                            children: [
                              Padding(
                                padding: EdgeInsets.only(left: 10, top: 10),
                                child: CircleAvatar(
                                  backgroundImage: NetworkImage(
                                      // 'http://119.28.131.94:82' +
                                      anchorEntitys != null
                                          ? anchorEntitys.length > 2
                                              ? 'http://119.28.131.94:82' +
                                                  anchorEntitys[2].avatar
                                              : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'
                                          : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'),
                                  radius: 30,
                                ),
                              ),
                              Container(
                                width: 80,
                                height: 80,
                                decoration: BoxDecoration(
                                  image: DecorationImage(
                                      image: AssetImage(
                                          'assets/images/secondrank.png')),
                                ),
                              ),
                            ],
                          ),
                          Row(
                            children: [
                              Text(
                                anchorEntitys != null
                                    ? anchorEntitys.length > 2
                                        ? anchorEntitys[2].nickname
                                        : '万字熊'
                                    : '万字熊',
                                style: TextStyle(
                                    color: Color(0xfff3f3f3), fontSize: 15),
                              ),
                              SizedBox(
                                width: 3,
                              ),
                              anchorEntitys != null
                                  ? anchorEntitys.length > 2
                                      ? anchorEntitys[2].sex == '男'
                                          ? Image.asset(
                                              'assets/images/personal_boy.png',
                                              width: 13,
                                              height: 13,
                                            )
                                          : Image.asset(
                                              'assets/images/personal_girl.png',
                                              width: 13,
                                              height: 13,
                                            )
                                      : Image.asset(
                                          'assets/images/personal_boy.png',
                                          width: 13,
                                          height: 13,
                                        )
                                  : Image.asset(
                                      'assets/images/personal_boy.png',
                                      width: 13,
                                      height: 13,
                                    ),
                              // Image.asset('assets/images/personal_girl.png',width: 13,height: 13,)
                            ],
                          ),
                          SizedBox(
                            height: 5,
                          ),
                          anchorEntitys != null
                              ? anchorEntitys.length > 2
                                  ? anchorEntitys[2].anchorTitle == '常在'
                                      ? Image.asset(
                                          'assets/images/changzaiicon.png',
                                          height: 12,
                                        )
                                      : anchorEntitys[2].anchorTitle == '良人'
                                          ? Image.asset(
                                              'assets/images/liangrenicon.png',
                                              height: 12,
                                            )
                                          : anchorEntitys[2].anchorTitle == '贵嫔'
                                              ? Image.asset(
                                                  'assets/images/guipinicon.png',
                                                  height: 12,
                                                )
                                              : anchorEntitys[2].anchorTitle ==
                                                      '贵妃'
                                                  ? Image.asset(
                                                      'assets/images/guifeiicon.png',
                                                      height: 12,
                                                    )
                                                  : anchorEntitys[2]
                                                              .anchorTitle ==
                                                          '皇后'
                                                      ? Image.asset(
                                                          'assets/images/huanghouicon.png',
                                                          height: 12,
                                                        )
                                                      : anchorEntitys[2]
                                                                  .anchorTitle ==
                                                              '神女'
                                                          ? Image.asset(
                                                              'assets/images/shennvicon.png',
                                                              height: 12,
                                                            )
                                                          : anchorEntitys[2]
                                                                      .anchorTitle ==
                                                                  '帝后'
                                                              ? Image.asset(
                                                                  'assets/images/dihouicon.png',
                                                                  height: 12,
                                                                )
                                                              : anchorEntitys[2]
                                                                          .anchorTitle ==
                                                                      '天君夫人'
                                                                  ? Image.asset(
                                                                      'assets/images/tianjunfurenicon.png',
                                                                      height:
                                                                          12,
                                                                    )
                                                                  : Image.asset(
                                                                      'assets/images/nvwaicon.png',
                                                                      height:
                                                                          12,
                                                                    )
                                  : Image.asset(
                                      'assets/images/changzaiicon.png',
                                      height: 12,
                                    )
                              : Image.asset(
                                  'assets/images/changzaiicon.png',
                                  height: 12,
                                ),
                          SizedBox(
                            height: 5,
                          ),
                          Row(
                            children: [
                              Image.asset(
                                'assets/images/rank_money.png',
                                width: 12.23,
                                height: 12.58,
                              ),
                              SizedBox(
                                width: 3,
                              ),
                              anchorEntitys != null
                                  ? anchorEntitys.length > 2
                                      ? Text(
                                          anchorEntitys[2].number,
                                          style: TextStyle(
                                              color: Color(0xffffffff),
                                              fontSize: 13),
                                        )
                                      : Text(
                                          '123456789',
                                          style: TextStyle(
                                              color: Color(0xffffffff),
                                              fontSize: 13),
                                        )
                                  : Text(
                                      '123456789',
                                      style: TextStyle(
                                          color: Color(0xffffffff),
                                          fontSize: 13),
                                    ),
                            ],
                          )
                        ],
                      ),
                      Spacer(),
                    ],
                  ),
                )
              : rankNum == 1
                  ? Container(
                      width: 375,
                      height: 252.5,
                      decoration: BoxDecoration(
                        image: DecorationImage(
                            image: AssetImage('assets/images/rankbg.png')),
                      ),
                      child: Row(
                        children: [
                          // Padding(padding: EdgeInsets.only(left: 20,top: 58.5),
                          //   child:
                          //   Column(
                          //     mainAxisAlignment: MainAxisAlignment.center,
                          //     children: [
                          //       Stack(
                          //         children: [
                          //           Padding(padding: EdgeInsets.only(left: 10,top: 10),
                          //             child:  CircleAvatar(
                          //               backgroundImage: NetworkImage(
                          //                 // 'http://119.28.131.94:82' +
                          //                   'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'),
                          //               radius: 30,
                          //             ),
                          //           ),
                          //           Container(
                          //             width:80 ,
                          //             height: 80,
                          //             decoration: BoxDecoration(
                          //               image: DecorationImage(
                          //                   image: AssetImage('assets/images/secondrank.png')),
                          //             ),
                          //
                          //           ),
                          //         ],
                          //       ),
                          //
                          //       SizedBox(
                          //         height: 8.5,
                          //       ),
                          //       Row(
                          //         children: [
                          //           Text('万字熊',style: TextStyle(color: Color(0xfff3f3f3),fontSize: 15),),
                          //           SizedBox(width: 3,),
                          //           Image.asset('assets/images/personal_boy.png',width: 13,height: 13,),
                          //           // Image.asset('assets/images/personal_girl.png',width: 13,height: 13,)
                          //         ],
                          //       ),
                          //       SizedBox(
                          //         height: 15,
                          //       ),
                          //       Row(
                          //         children: [
                          //           Image.asset('assets/images/rank_money.png',width: 12.23,height: 12.58,),
                          //           SizedBox(width: 3,),
                          //           Text('123456789',style: TextStyle(color: Color(0xffffffff),fontSize: 13),),
                          //         ],
                          //       )
                          //     ],
                          //   ),
                          // ),
                          Spacer(),
                          Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: [
                              Stack(
                                children: [
                                  Padding(
                                    padding: EdgeInsets.only(left: 10, top: 10),
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          // 'http://119.28.131.94:82' +
                                          contributeRankEntitys != null
                                              ? contributeRankEntitys.length > 1
                                                  ? 'http://119.28.131.94:82' +
                                                      contributeRankEntitys[1]
                                                          .avatar
                                                  : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'
                                              : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'),
                                      radius: 30,
                                    ),
                                  ),
                                  Container(
                                    width: 80,
                                    height: 80,
                                    decoration: BoxDecoration(
                                      image: DecorationImage(
                                          image: AssetImage(
                                              'assets/images/secondrank.png')),
                                    ),
                                  ),
                                ],
                              ),
                              Row(
                                children: [
                                  Text(
                                    contributeRankEntitys != null
                                        ? contributeRankEntitys.length > 1
                                            ? contributeRankEntitys[1].nickname
                                            : '万字熊'
                                        : '万字熊',
                                    style: TextStyle(
                                        color: Color(0xfff3f3f3), fontSize: 15),
                                  ),
                                  SizedBox(
                                    width: 3,
                                  ),
                                  contributeRankEntitys != null
                                      ? contributeRankEntitys.length > 1
                                          ? contributeRankEntitys[1].sex == '男'
                                              ? Image.asset(
                                                  'assets/images/personal_boy.png',
                                                  width: 13,
                                                  height: 13,
                                                )
                                              : Image.asset(
                                                  'assets/images/personal_girl.png',
                                                  width: 13,
                                                  height: 13,
                                                )
                                          : Image.asset(
                                              'assets/images/personal_boy.png',
                                              width: 13,
                                              height: 13,
                                            )
                                      : Image.asset(
                                          'assets/images/personal_boy.png',
                                          width: 13,
                                          height: 13,
                                        ),
                                  // Image.asset('assets/images/personal_girl.png',width: 13,height: 13,)
                                ],
                              ),
                              SizedBox(
                                height: 5,
                              ),
                              contributeRankEntitys != null
                                  ? contributeRankEntitys.length > 1
                                      ? contributeRankEntitys[1].title == '平民'
                                          ? Image.asset(
                                              'assets/images/pinmingicon.png',
                                              height: 12,
                                            )
                                          : contributeRankEntitys[1]
                                                      .title ==
                                                  '子爵'
                                              ? Image.asset(
                                                  'assets/images/zijueicon.png',
                                                  height: 12,
                                                )
                                              : contributeRankEntitys[1]
                                                          .title ==
                                                      '伯爵'
                                                  ? Image.asset(
                                                      'assets/images/bojueicon.png',
                                                      height: 12,
                                                    )
                                                  : contributeRankEntitys[1]
                                                              .title ==
                                                          '亲王'
                                                      ? Image.asset(
                                                          'assets/images/qinwangicon.png',
                                                          height: 12,
                                                        )
                                                      : contributeRankEntitys[1]
                                                                  .title ==
                                                              '皇帝'
                                                          ? Image.asset(
                                                              'assets/images/huangdiicon.png',
                                                              height: 12,
                                                            )
                                                          : contributeRankEntitys[
                                                                          1]
                                                                      .title ==
                                                                  '神'
                                                              ? Image.asset(
                                                                  'assets/images/shenicon.png',
                                                                  height: 12,
                                                                )
                                                              : contributeRankEntitys[
                                                                              1]
                                                                          .title ==
                                                                      '大帝'
                                                                  ? Image.asset(
                                                                      'assets/images/dadiicon.png',
                                                                      height:
                                                                          12,
                                                                    )
                                                                  : contributeRankEntitys[1]
                                                                              .title ==
                                                                          '天君'
                                                                      ? Image
                                                                          .asset(
                                                                          'assets/images/tianjunicon.png',
                                                                          height:
                                                                              12,
                                                                        )
                                                                      : Image
                                                                          .asset(
                                                                          'assets/images/zaowuzhuicon.png',
                                                                          height:
                                                                              12,
                                                                        )
                                      : Image.asset(
                                          'assets/images/pinmingicon.png',
                                          height: 12,
                                        )
                                  : Image.asset(
                                      'assets/images/pinmingicon.png',
                                      height: 12,
                                    ),
                              SizedBox(
                                height: 5,
                              ),
                              Row(
                                children: [
                                  Image.asset(
                                    'assets/images/rank_money.png',
                                    width: 12.23,
                                    height: 12.58,
                                  ),
                                  SizedBox(
                                    width: 3,
                                  ),
                                  contributeRankEntitys != null
                                      ? contributeRankEntitys.length > 1
                                          ? Text(
                                              contributeRankEntitys[1].number,
                                              style: TextStyle(
                                                  color: Color(0xffffffff),
                                                  fontSize: 13),
                                            )
                                          : Text(
                                              '123456789',
                                              style: TextStyle(
                                                  color: Color(0xffffffff),
                                                  fontSize: 13),
                                            )
                                      : Text(
                                          '123456789',
                                          style: TextStyle(
                                              color: Color(0xffffffff),
                                              fontSize: 13),
                                        ),
                                ],
                              )
                            ],
                          ),
                          Spacer(),
                          Column(
                            children: [
                              SizedBox(
                                height: 20,
                              ),
                              Stack(
                                children: [
                                  Padding(
                                    padding: EdgeInsets.only(left: 10, top: 10),
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          // 'http://119.28.131.94:82' +
                                          contributeRankEntitys != null
                                              ? contributeRankEntitys.length > 0
                                                  ? 'http://119.28.131.94:82' +
                                                      contributeRankEntitys[0]
                                                          .avatar
                                                  : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'
                                              : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'),
                                      radius: 30,
                                    ),
                                  ),
                                  Container(
                                    width: 80,
                                    height: 80,
                                    decoration: BoxDecoration(
                                      image: DecorationImage(
                                          image: AssetImage(
                                              'assets/images/secondrank.png')),
                                    ),
                                  ),
                                ],
                              ),
                              Row(
                                children: [
                                  Text(
                                    contributeRankEntitys != null
                                        ? contributeRankEntitys.length > 0
                                            ? contributeRankEntitys[0].nickname
                                            : '万字熊'
                                        : '万字熊',
                                    style: TextStyle(
                                        color: Color(0xfff3f3f3), fontSize: 15),
                                  ),
                                  SizedBox(
                                    width: 3,
                                  ),
                                  contributeRankEntitys != null
                                      ? contributeRankEntitys.length > 0
                                          ? contributeRankEntitys[0].sex == '男'
                                              ? Image.asset(
                                                  'assets/images/personal_boy.png',
                                                  width: 13,
                                                  height: 13,
                                                )
                                              : Image.asset(
                                                  'assets/images/personal_girl.png',
                                                  width: 13,
                                                  height: 13,
                                                )
                                          : Image.asset(
                                              'assets/images/personal_boy.png',
                                              width: 13,
                                              height: 13,
                                            )
                                      : Image.asset(
                                          'assets/images/personal_boy.png',
                                          width: 13,
                                          height: 13,
                                        ),
                                  // Image.asset('assets/images/personal_girl.png',width: 13,height: 13,)
                                ],
                              ),
                              SizedBox(
                                height: 5,
                              ),
                              contributeRankEntitys != null
                                  ? contributeRankEntitys.length > 0
                                      ? contributeRankEntitys[0].title == '平民'
                                          ? Image.asset(
                                              'assets/images/pinmingicon.png',
                                              height: 12,
                                            )
                                          : contributeRankEntitys[0]
                                                      .title ==
                                                  '子爵'
                                              ? Image.asset(
                                                  'assets/images/zijueicon.png',
                                                  height: 12,
                                                )
                                              : contributeRankEntitys[0]
                                                          .title ==
                                                      '伯爵'
                                                  ? Image.asset(
                                                      'assets/images/bojueicon.png',
                                                      height: 12,
                                                    )
                                                  : contributeRankEntitys[0]
                                                              .title ==
                                                          '亲王'
                                                      ? Image.asset(
                                                          'assets/images/qinwangicon.png',
                                                          height: 12,
                                                        )
                                                      : contributeRankEntitys[0]
                                                                  .title ==
                                                              '皇帝'
                                                          ? Image.asset(
                                                              'assets/images/huangdiicon.png',
                                                              height: 12,
                                                            )
                                                          : contributeRankEntitys[
                                                                          0]
                                                                      .title ==
                                                                  '神'
                                                              ? Image.asset(
                                                                  'assets/images/shenicon.png',
                                                                  height: 12,
                                                                )
                                                              : contributeRankEntitys[
                                                                              0]
                                                                          .title ==
                                                                      '大帝'
                                                                  ? Image.asset(
                                                                      'assets/images/dadiicon.png',
                                                                      height:
                                                                          12,
                                                                    )
                                                                  : contributeRankEntitys[0]
                                                                              .title ==
                                                                          '天君'
                                                                      ? Image
                                                                          .asset(
                                                                          'assets/images/tianjunicon.png',
                                                                          height:
                                                                              12,
                                                                        )
                                                                      : Image
                                                                          .asset(
                                                                          'assets/images/zaowuzhuicon.png',
                                                                          height:
                                                                              12,
                                                                        )
                                      : Image.asset(
                                          'assets/images/pinmingicon.png',
                                          height: 12,
                                        )
                                  : Image.asset(
                                      'assets/images/pinmingicon.png',
                                      height: 12,
                                    ),
                              SizedBox(
                                height: 5,
                              ),
                              Row(
                                children: [
                                  Image.asset(
                                    'assets/images/rank_money.png',
                                    width: 12.23,
                                    height: 12.58,
                                  ),
                                  SizedBox(
                                    width: 3,
                                  ),
                                  contributeRankEntitys != null
                                      ? contributeRankEntitys.length > 0
                                          ? Text(
                                              contributeRankEntitys[0].number,
                                              style: TextStyle(
                                                  color: Color(0xffffffff),
                                                  fontSize: 13),
                                            )
                                          : Text(
                                              '123456789',
                                              style: TextStyle(
                                                  color: Color(0xffffffff),
                                                  fontSize: 13),
                                            )
                                      : Text(
                                          '123456789',
                                          style: TextStyle(
                                              color: Color(0xffffffff),
                                              fontSize: 13),
                                        ),
                                ],
                              )
                            ],
                          ),
                          Spacer(),
                          Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: [
                              Stack(
                                children: [
                                  Padding(
                                    padding: EdgeInsets.only(left: 10, top: 10),
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          // 'http://119.28.131.94:82' +
                                          contributeRankEntitys != null
                                              ? contributeRankEntitys.length > 2
                                                  ? 'http://119.28.131.94:82' +
                                                      contributeRankEntitys[2]
                                                          .avatar
                                                  : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'
                                              : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'),
                                      radius: 30,
                                    ),
                                  ),
                                  Container(
                                    width: 80,
                                    height: 80,
                                    decoration: BoxDecoration(
                                      image: DecorationImage(
                                          image: AssetImage(
                                              'assets/images/secondrank.png')),
                                    ),
                                  ),
                                ],
                              ),
                              Row(
                                children: [
                                  Text(
                                    contributeRankEntitys != null
                                        ? contributeRankEntitys.length > 2
                                            ? contributeRankEntitys[2].nickname
                                            : '万字熊'
                                        : '万字熊',
                                    style: TextStyle(
                                        color: Color(0xfff3f3f3), fontSize: 15),
                                  ),
                                  SizedBox(
                                    width: 3,
                                  ),
                                  contributeRankEntitys != null
                                      ? contributeRankEntitys.length > 2
                                          ? contributeRankEntitys[2].sex == '男'
                                              ? Image.asset(
                                                  'assets/images/personal_boy.png',
                                                  width: 13,
                                                  height: 13,
                                                )
                                              : Image.asset(
                                                  'assets/images/personal_girl.png',
                                                  width: 13,
                                                  height: 13,
                                                )
                                          : Image.asset(
                                              'assets/images/personal_boy.png',
                                              width: 13,
                                              height: 13,
                                            )
                                      : Image.asset(
                                          'assets/images/personal_boy.png',
                                          width: 13,
                                          height: 13,
                                        ),
                                  // Image.asset('assets/images/personal_girl.png',width: 13,height: 13,)
                                ],
                              ),
                              SizedBox(
                                height: 5,
                              ),
                              contributeRankEntitys != null
                                  ? contributeRankEntitys.length > 2
                                      ? contributeRankEntitys[2].title == '平民'
                                          ? Image.asset(
                                              'assets/images/pinmingicon.png',
                                              height: 12,
                                            )
                                          : contributeRankEntitys[2]
                                                      .title ==
                                                  '子爵'
                                              ? Image.asset(
                                                  'assets/images/zijueicon.png',
                                                  height: 12,
                                                )
                                              : contributeRankEntitys[2]
                                                          .title ==
                                                      '伯爵'
                                                  ? Image.asset(
                                                      'assets/images/bojueicon.png',
                                                      height: 12,
                                                    )
                                                  : contributeRankEntitys[2]
                                                              .title ==
                                                          '亲王'
                                                      ? Image.asset(
                                                          'assets/images/qinwangicon.png',
                                                          height: 12,
                                                        )
                                                      : contributeRankEntitys[2]
                                                                  .title ==
                                                              '皇帝'
                                                          ? Image.asset(
                                                              'assets/images/huangdiicon.png',
                                                              height: 12,
                                                            )
                                                          : contributeRankEntitys[
                                                                          2]
                                                                      .title ==
                                                                  '神'
                                                              ? Image.asset(
                                                                  'assets/images/shenicon.png',
                                                                  height: 12,
                                                                )
                                                              : contributeRankEntitys[
                                                                              2]
                                                                          .title ==
                                                                      '大帝'
                                                                  ? Image.asset(
                                                                      'assets/images/dadiicon.png',
                                                                      height:
                                                                          12,
                                                                    )
                                                                  : contributeRankEntitys[2]
                                                                              .title ==
                                                                          '天君'
                                                                      ? Image
                                                                          .asset(
                                                                          'assets/images/tianjunicon.png',
                                                                          height:
                                                                              12,
                                                                        )
                                                                      : Image
                                                                          .asset(
                                                                          'assets/images/zaowuzhuicon.png',
                                                                          height:
                                                                              12,
                                                                        )
                                      : Image.asset(
                                          'assets/images/pinmingicon.png',
                                          height: 12,
                                        )
                                  : Image.asset(
                                      'assets/images/pinmingicon.png',
                                      height: 12,
                                    ),
                              SizedBox(
                                height: 5,
                              ),
                              Row(
                                children: [
                                  Image.asset(
                                    'assets/images/rank_money.png',
                                    width: 12.23,
                                    height: 12.58,
                                  ),
                                  SizedBox(
                                    width: 3,
                                  ),
                                  contributeRankEntitys != null
                                      ? contributeRankEntitys.length > 2
                                          ? Text(
                                              contributeRankEntitys[2].number,
                                              style: TextStyle(
                                                  color: Color(0xffffffff),
                                                  fontSize: 13),
                                            )
                                          : Text(
                                              '123456789',
                                              style: TextStyle(
                                                  color: Color(0xffffffff),
                                                  fontSize: 13),
                                            )
                                      : Text(
                                          '123456789',
                                          style: TextStyle(
                                              color: Color(0xffffffff),
                                              fontSize: 13),
                                        ),
                                ],
                              )
                            ],
                          ),
                          Spacer(),
                        ],
                      ),
                    )
                  : Container(
                      width: 375,
                      height: 252.5,
                      decoration: BoxDecoration(
                        image: DecorationImage(
                            image: AssetImage('assets/images/rankbg.png')),
                      ),
                      child: Row(
                        children: [
                          // Padding(padding: EdgeInsets.only(left: 20,top: 58.5),
                          //   child:
                          //   Column(
                          //     mainAxisAlignment: MainAxisAlignment.center,
                          //     children: [
                          //       Stack(
                          //         children: [
                          //           Padding(padding: EdgeInsets.only(left: 10,top: 10),
                          //             child:  CircleAvatar(
                          //               backgroundImage: NetworkImage(
                          //                 // 'http://119.28.131.94:82' +
                          //                   'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'),
                          //               radius: 30,
                          //             ),
                          //           ),
                          //           Container(
                          //             width:80 ,
                          //             height: 80,
                          //             decoration: BoxDecoration(
                          //               image: DecorationImage(
                          //                   image: AssetImage('assets/images/secondrank.png')),
                          //             ),
                          //
                          //           ),
                          //         ],
                          //       ),
                          //
                          //       SizedBox(
                          //         height: 8.5,
                          //       ),
                          //       Row(
                          //         children: [
                          //           Text('万字熊',style: TextStyle(color: Color(0xfff3f3f3),fontSize: 15),),
                          //           SizedBox(width: 3,),
                          //           Image.asset('assets/images/personal_boy.png',width: 13,height: 13,),
                          //           // Image.asset('assets/images/personal_girl.png',width: 13,height: 13,)
                          //         ],
                          //       ),
                          //       SizedBox(
                          //         height: 15,
                          //       ),
                          //       Row(
                          //         children: [
                          //           Image.asset('assets/images/rank_money.png',width: 12.23,height: 12.58,),
                          //           SizedBox(width: 3,),
                          //           Text('123456789',style: TextStyle(color: Color(0xffffffff),fontSize: 13),),
                          //         ],
                          //       )
                          //     ],
                          //   ),
                          // ),
                          Spacer(),
                          Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: [
                              Stack(
                                children: [
                                  Padding(
                                    padding: EdgeInsets.only(left: 10, top: 10),
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          // 'http://119.28.131.94:82' +
                                          familyEntitys != null
                                              ? familyEntitys.length > 1
                                                  ? 'http://119.28.131.94:82' +
                                                      familyEntitys[1].icon
                                                  : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'
                                              : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'),
                                      radius: 30,
                                    ),
                                  ),
                                  Container(
                                    width: 80,
                                    height: 80,
                                    decoration: BoxDecoration(
                                      image: DecorationImage(
                                          image: AssetImage(
                                              'assets/images/secondrank.png')),
                                    ),
                                  ),
                                ],
                              ),
                              Row(
                                children: [
                                  Text(
                                    familyEntitys != null
                                        ? familyEntitys.length > 1
                                            ? familyEntitys[1].name
                                            : '万字熊'
                                        : '万字熊',
                                    style: TextStyle(
                                        color: Color(0xfff3f3f3), fontSize: 15),
                                  ),
                                  // Image.asset('assets/images/personal_girl.png',width: 13,height: 13,)
                                ],
                              ),
                              SizedBox(
                                height: 5,
                              ),
                              Row(
                                children: [
                                  Image.asset(
                                    'assets/images/rank_money.png',
                                    width: 12.23,
                                    height: 12.58,
                                  ),
                                  SizedBox(
                                    width: 3,
                                  ),
                                  familyEntitys != null
                                      ? familyEntitys.length > 1
                                          ? Text(
                                              familyEntitys[1].totalContribution,
                                              style: TextStyle(
                                                  color: Color(0xffffffff),
                                                  fontSize: 13),
                                            )
                                          : Text(
                                              '123456789',
                                              style: TextStyle(
                                                  color: Color(0xffffffff),
                                                  fontSize: 13),
                                            )
                                      : Text(
                                          '123456789',
                                          style: TextStyle(
                                              color: Color(0xffffffff),
                                              fontSize: 13),
                                        ),
                                ],
                              )
                            ],
                          ),
                          Spacer(),
                          Column(
                            children: [
                              SizedBox(
                                height: 20,
                              ),
                              Stack(
                                children: [
                                  Padding(
                                    padding: EdgeInsets.only(left: 10, top: 10),
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          // 'http://119.28.131.94:82' +
                                          familyEntitys != null
                                              ? familyEntitys.length > 0
                                                  ? 'http://119.28.131.94:82' +
                                                      familyEntitys[0].icon
                                                  : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'
                                              : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'),
                                      radius: 30,
                                    ),
                                  ),
                                  Container(
                                    width: 80,
                                    height: 80,
                                    decoration: BoxDecoration(
                                      image: DecorationImage(
                                          image: AssetImage(
                                              'assets/images/secondrank.png')),
                                    ),
                                  ),
                                ],
                              ),
                              Row(
                                children: [
                                  Text(
                                    familyEntitys != null
                                        ? familyEntitys.length > 0
                                            ? familyEntitys[0].name
                                            : '万字熊'
                                        : '万字熊',
                                    style: TextStyle(
                                        color: Color(0xfff3f3f3), fontSize: 15),
                                  ),
                                  // Image.asset('assets/images/personal_girl.png',width: 13,height: 13,)
                                ],
                              ),
                              SizedBox(
                                height: 5,
                              ),
                              Row(
                                children: [
                                  Image.asset(
                                    'assets/images/rank_money.png',
                                    width: 12.23,
                                    height: 12.58,
                                  ),
                                  SizedBox(
                                    width: 3,
                                  ),
                                  familyEntitys != null
                                      ? familyEntitys.length > 0
                                          ? Text(
                                              familyEntitys[0].totalContribution,
                                              style: TextStyle(
                                                  color: Color(0xffffffff),
                                                  fontSize: 13),
                                            )
                                          : Text(
                                              '123456789',
                                              style: TextStyle(
                                                  color: Color(0xffffffff),
                                                  fontSize: 13),
                                            )
                                      : Text(
                                          '123456789',
                                          style: TextStyle(
                                              color: Color(0xffffffff),
                                              fontSize: 13),
                                        ),
                                ],
                              )
                            ],
                          ),
                          Spacer(),
                          Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: [
                              Stack(
                                children: [
                                  Padding(
                                    padding: EdgeInsets.only(left: 10, top: 10),
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          // 'http://119.28.131.94:82' +
                                          familyEntitys != null
                                              ? familyEntitys.length > 2
                                                  ? 'http://119.28.131.94:82' +
                                                      familyEntitys[2].icon
                                                  : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'
                                              : 'https://img0.baidu.com/it/u=1406515706,336510358&fm=26&fmt=auto&gp=0.jpg'),
                                      radius: 30,
                                    ),
                                  ),
                                  Container(
                                    width: 80,
                                    height: 80,
                                    decoration: BoxDecoration(
                                      image: DecorationImage(
                                          image: AssetImage(
                                              'assets/images/secondrank.png')),
                                    ),
                                  ),
                                ],
                              ),
                              Row(
                                children: [
                                  Text(
                                    familyEntitys != null
                                        ? familyEntitys.length > 2
                                            ? familyEntitys[2].name
                                            : '万字熊'
                                        : '万字熊',
                                    style: TextStyle(
                                        color: Color(0xfff3f3f3), fontSize: 15),
                                  ),
                                  // Image.asset('assets/images/personal_girl.png',width: 13,height: 13,)
                                ],
                              ),
                              SizedBox(
                                height: 5,
                              ),
                              Row(
                                children: [
                                  Image.asset(
                                    'assets/images/rank_money.png',
                                    width: 12.23,
                                    height: 12.58,
                                  ),
                                  SizedBox(
                                    width: 3,
                                  ),
                                  familyEntitys != null
                                      ? familyEntitys.length > 2
                                          ? Text(
                                              familyEntitys[2].totalContribution,
                                              style: TextStyle(
                                                  color: Color(0xffffffff),
                                                  fontSize: 13),
                                            )
                                          : Text(
                                              '123456789',
                                              style: TextStyle(
                                                  color: Color(0xffffffff),
                                                  fontSize: 13),
                                            )
                                      : Text(
                                          '123456789',
                                          style: TextStyle(
                                              color: Color(0xffffffff),
                                              fontSize: 13),
                                        ),
                                ],
                              )
                            ],
                          ),
                          Spacer(),
                        ],
                      ),
                    ),
          SizedBox(
            height: 13.5,
          ),
          SizedBox(
            height: 13.5,
          ),
          rankNum == 0
              ? anchorEntitys != null ? anchorEntitys.length > 3
                  ? SizedBox(
                      height: SizeUtil.px(size.height - 90),
                      child: ListView.builder(
                          itemCount: anchorEntitys.length - 3,
                          controller: _scrollController,
                          shrinkWrap: true,
                          itemBuilder: (context, index) {
                            return NewRankList(
                              anchorEntity: anchorEntitys[index + 3],
                              index: (index + 4),rankNum: rankNum,
                            );
                          }),
                    )
                  : Container(
                      width: 0,
                      height: 0,
                    ): Container(
            width: 0,
            height: 0,
          )
              : rankNum == 1
                  ? contributeRankEntitys != null ? contributeRankEntitys.length > 3
                      ? SizedBox(
                          height: SizeUtil.px(size.height - 90),
                          child: ListView.builder(
                              itemCount: contributeRankEntitys.length - 3,
                              controller: _scrollController,
                              shrinkWrap: true,
                              itemBuilder: (context, index) {
                                return NewRankList(
                                  contributeRankEntity:
                                      contributeRankEntitys[index + 3],
                                  index: (index + 4),rankNum: rankNum,
                                );
                              }),
                        )
                      : Container(
                          width: 0,
                          height: 0,
                        ): Container(
                          width: 0,
                          height: 0,
                        )
                  : familyEntitys != null ? familyEntitys.length > 3
                      ? SizedBox(
                          height: SizeUtil.px(size.height - 90),
                          child: ListView.builder(
                              itemCount: familyEntitys.length - 3,
                              controller: _scrollController,
                              shrinkWrap: true,
                              itemBuilder: (context, index) {
                                return NewRankList(
                                    familyEntity: familyEntitys[index + 3],
                                    index: (index + 4),rankNum: rankNum,);
                              }),
                        )
                      : Container(
                          width: 0,
                          height: 0,
                        ): Container(
                          width: 0,
                          height: 0,
                        ),
        ],
      ),
    );
  }

  List<Widget> _getTabs() {
    List<Widget> tabWidgets = List();
    for (int i = 0; i < 3; i++) {
      tabWidgets.add(GestureDetector(
        child: _currentSelectIndex == i
            ? Container(
                width: 85,
                height: 29,
                decoration: BoxDecoration(
                  color: Color(0xffff215d),
                  borderRadius: BorderRadius.all(Radius.circular(14.5)),
                ),
                child: Center(
                  child: Text(
                    i == 0
                        ? '日榜单'
                        : i == 1
                            ? '周榜单'
                            : '月榜单',
                    style: TextStyle(color: Color(0xffffffff), fontSize: 16),
                  ),
                ))
            : Container(
                width: 85,
                height: 29,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.all(Radius.circular(14.5)),
                ),
                child: Center(
                  child: Text(
                    i == 0
                        ? '日榜单'
                        : i == 1
                            ? '周榜单'
                            : '月榜单',
                    style: TextStyle(color: Color(0xffffffff), fontSize: 16),
                  ),
                )),
        onTap: () {
          setState(() {
            _currentSelectIndex = i;
            getRankList();
          });
        },
      ));
    }
    return tabWidgets;
  }

  Future<void> getRankList() async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    String appToken = prefs.getString('app-token');
    BaseRequest request;
    if (widget.rankName == '魅力榜') {
      setState(() {
        rankNum = 0;
        request = CharmRankRequest();
      });
    } else if (widget.rankName == '贡献榜') {
      setState(() {
        rankNum = 1;
        request = AllContributeRequest();
      });
    } else {
      setState(() {
        rankNum = 2;
        request = FamilyRankRequest();
      });
    }
    request
        .add('type', 2)
        .add('time_type', (_currentSelectIndex + 1))
        .addHeader('usertoken', appToken);
    var result = await HiNet.getInstance().fire(request);
    if (result['code'] == -1) {
      TxUtils.showErrorToast('登录失效，请重新登录', context);
      Navigator.pop(context);
      Navigator.of(context).push(MaterialPageRoute(
        builder: (context) {
          return LoginPage(
            arguments: {'loginCode': '-1'},
          );
        },
      ));
    } else if (result['code'] == 0) {
      List<Map<String, dynamic>> listMap =
          new List<Map<String, dynamic>>.from(result['data']);
      List<ContributeRankEntity> list1;
      List<FamilyEntity> list2;
      List<AnchorEntity> list3;
      if (widget.rankName == '魅力榜') {
        for (int i = 0; i < listMap.length; i++) {
          list3.add(AnchorEntity.fromJson(listMap[i]));
        }
        setState(() {
          anchorEntitys = list3;
        });
      } else if (widget.rankName == '贡献榜') {
        for (int i = 0; i < listMap.length; i++) {
          list1.add(ContributeRankEntity.fromJson(listMap[i]));
        }
        setState(() {
          contributeRankEntitys = list1;
        });
      } else {
        for (int i = 0; i < listMap.length; i++) {
          list2.add(FamilyEntity.fromJson(listMap[i]));
        }
        setState(() {
          familyEntitys = list2;
        });
      }
    }
  }
}
